package com.chixing.ih.module.programmer.mapper;

import com.chixing.ih.common.IhRepository;
import com.chixing.ih.module.programmer.mapper.provider.WorkExperMapperProvider;
import com.chixing.ih.module.programmer.pojo.WorkExper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘岩
 * Date: 2020-09-29
 * Time: 16:59
 *
 * @version 1.0
 */
@Mapper
public interface WorkExperMapper {

    @UpdateProvider(type = WorkExperMapperProvider.class, method = "updateOne")
    int updateOne(WorkExper workExper);


    @SelectProvider(type = WorkExperMapperProvider.class, method = "listAll")
    @Results(id = "workExperMap", value = {
            @Result(id = true, column = "id", property = "id"),
            @Result(column = "user_id", property = "userId"),
            @Result(column = "begin_time", property = "beginTime"),
            @Result(column = "end_time", property = "endTime"),
            @Result(column = "company", property = "company"),
            @Result(column = "position", property = "position"),
            @Result(column = "work_experience_description", property = "workExperDesc"),
            @Result(column = "prove_image_url", property = "proveImageUrl"),
    })
    List<WorkExper> listAll(long userId);


    @InsertProvider(type = WorkExperMapperProvider.class, method = "insertOne")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    int insertOne(WorkExper workExper);

    @DeleteProvider(type = WorkExperMapperProvider.class, method = "deleteOneById")
    int deleteOne(long id);


}


